<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="org.apache.shiro.SecurityUtils" %>
<%@ page import="com.topisv.tms.service.account.ShiroDbRealm.ShiroUser" %>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<script type="text/javascript">
   	$(function() {
   		$("#_fromDate").datepicker({ format:'yyyy-mm-dd'});
		var now = new Date();
		if(!$("#_fromDate").val()){
			$("#_fromDate").val(now.Format("yyyy-MM-dd"));
		}
		
   	})
   	
	//查询
	function query() {
   		$("#queryForm").attr("action", "${ctx}/v2/unProcessXml/queryCountOrder");
		$("#queryForm").submit();
	}
   	
   	//提交
   	function processXml(){
   		var warehouseCode = $("#_warehouseCode").val();
   		if(warehouseCode.length == 0){
   			jAlert("仓库不能为空!","错误提示");
   			return false;
   		}
   		var num = $("#_num").val();
		if (num > 2000) {
			jAlert("数量不能超过2000!","错误提示");
			return false;
		}
   		$("#queryForm").attr("action", "${ctx}/v2/unProcessXml/processXml");
		$("#queryForm").submit();
	
   	}
	</script>
</head>
<body>
	<sention class= "content">
	<c:if test="${not empty message}">
		<div id="message" class="alert alert-success"><button data-dismiss="alert" class="close">×</button>${message}</div>
	</c:if>
	<!-- 查询条件  start-->
   	<div class="row">
	<div class="col-md-12">
			<!-- Primary box -->
			<div class="box box-solid box-primary" >
			    
				<div class="box-header">
					<i class="fa fa-search"></i>
					<h3 class="box-title">搜索栏</h3>
				</div>
				
				
				
				<div class="box-body">
				    <form class="form-search" id="queryForm" method="post" >
				    <!-- 第一行 -->
					<div class="form-group row">
						
						<div class="col-sm-2">
							<div class="input-group col-sm-12">
								<span class="input-group-text"> &nbsp;时间: </span>
								<input type="text" name="_fromDate" id="_fromDate"
									value="${param._fromDate}" class="form-control required">
							</div>
				         </div>
						<div class="col-sm-2">
							<div class="input-textgroup col-sm-12">
								<span class="input-group-text"> 商家： </span> 
								<select class="form-control span3" id="_customerCode" name="_customerCode"  value="${param._customerCode}" onchange="ajaxAreaGroup(this,'_warehouseCode')">
									<option value=""></option>
									<c:forEach items="${customerList}" var="customer">
										<option value="${customer.customerCode}"
											<c:if test="${customerCode eq customer.customerCode}">selected=selected</c:if>>${customer.customerName}</option>
									</c:forEach>
								</select>
							</div>
						</div>
						
						<div class="col-sm-2">
							<div class="input-textgroup col-sm-12">
								<span class="input-group-text"> 仓库： </span> 
								<select class="form-control span3" id="_warehouseCode" name="_warehouseCode"  value="${param._warehouseCode}">
									<option value="">全部</option>
									<c:forEach items="${allWarehouseList}" var="warehouse">
										<option value="${warehouse.groupCode}"  <c:if test="${warehouseCode eq warehouse.groupCode}">selected=selected</c:if>>${warehouse.groupName}</option>>${warehouse.groupName}</option>
									</c:forEach>
								</select>
							</div>
							
						</div>
						
					
						
						<div class="col-sm-2">
							<div class="input-textgroup col-sm-12">
								<span class="input-group-text"> 数量： </span> 
								<select class="form-control span3" id="_num" name="_num"  value = "500">
									<option value="500">500</option>
									<option value="1000">1000</option>
									<option value="1500">1500</option>
									<option value="2000">2000</option>
								</select>
							</div>
						</div>
						<div class="col-sm-2">
								<button class="btn btn-info" type="button" onclick="query();">搜索</button>
								<button class="btn btn-info" type="button" onclick="processXml();">提交</button>
						</div>
					</div>
						
						
					</form>
				</div>

			</div>

	 </div>
	</div>
    <!-- 查询条件 end -->
  
    <!-- 查询结果 start -->
	<div class="form-group row">
		<div class="col-md-12">
			<div class="box box-solid box-primary">
				<div class="box-header">
					<i class="fa fa-list"></i>
					<h3 class="box-title">查询结果</h3>
					<div class="box-tools pull-right">
						<button class="btn btn-primary btn-sm" data-widget="collapse" type="button">
							<i class="fa fa-minus"></i>
						</button>
					</div>
				</div>
				<div class="box-body">

	
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead><tr>
			<th>仓库</th>
		   <th>未处理报文数量</th>
		   <th> 待处理订单数量</th>
		   <th> 不可处理订单数量</th>
		</tr></thead>
		<tbody>
		<c:forEach items="${warehouseNumList}" var="warehouse">
			<tr>
				<td>${ warehouse.groupName}</td>			
				<td>${ warehouse.unProcessXmlNum}</td>	
				<td>${ warehouse.waitProcessOrderNum}</td>	
				<td>${ warehouse.unProcessOrderNum}</td>		
			</tr>					
		</c:forEach>
		
		</tbody>
	</table>
	</div>
	</div></div>
	</div>
	</sention>
</body>
</html>